package com.sojson.util.mq.rabbit.interfaces;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sojson.util.StringUtil;
import com.sojson.util.mq.rabbit.immit.interfaces.IRabbitExchangeUtil;

/**
 * Rabbit基础工具类接口
 * 
 * @author liu
 * @date 2022-06-16
 */
public interface IRabbitBaseUtil {

    Logger LOG = LoggerFactory.getLogger(IRabbitExchangeUtil.class);

    /**
     * 获取 交换机名称
     * 
     * @param exchange
     * @return
     */
    default String getExchangeName(String exchange) {
        if (StringUtil.isBlankString(exchange)) {
            return StringUtil.EMPTY;
        }

        return StringUtil.getKeyBase(exchange);
    }

    /**
     * 获取 队列名称
     * 
     * @param queueName
     * @return
     */
    default String getQueueName(String queueName) {
        if (StringUtil.isBlankString(queueName)) {
            return StringUtil.EMPTY;
        }

        return StringUtil.getKeyBase(queueName);
    }

    /**
     * 获取 路由Key名称
     * 
     * @param routingKey
     * @return
     */
    default String getRoutingKeyName(String routingKey) {
        if (StringUtil.isBlankString(routingKey)) {
            return StringUtil.EMPTY;
        }

        return StringUtil.getKeyBase(routingKey);
    }

}